var app = getApp()
var host = app.data.host
var httpUtil = require("../utils/httpUtil.js")
var getAppointmentListUrl = host + 'getAppointmentList'
var getAppointmentProjectListUrl = host + 'getAppointmentProjectList'
var cancelReserveUrl = host +"cancelReserve"
//用户预约
function getAppointmentList(cb) {
  var data = {
    cid: app.data.user.id
  }
  httpUtil.get(getAppointmentListUrl, data, cb)
}
//用户预约对应项目
function getAppointmentProjectList(id, cb) {
  httpUtil.get(getAppointmentProjectListUrl, {
    pid: id
  }, cb)
}
//取消预约
function cancelReserve(data,cb){
  data.cusId = app.data.user.id
  httpUtil.post(cancelReserveUrl,data,cb)
}

module.exports = {
  getAppointmentList: getAppointmentList,
  getAppointmentProjectList: getAppointmentProjectList,
  cancelReserve: cancelReserve
}